#ifndef __DEV_PS2_H__
#define __DEV_PS2_H__
#include "dev_comm.h"


#define PS2_DAT_R Drv_Ps2_Data_Read()

#define PS2_CLK_H Drv_Ps2_Clk_Write(1)
#define PS2_CLK_L Drv_Ps2_Clk_Write(0)

#define PS2_CS_H Drv_Ps2_Cs_Write(1)
#define PS2_CS_L Drv_Ps2_Cs_Write(0)

#define PS2_CMD_H Drv_Ps2_Cmd_Write(1)
#define PS2_CMD_L Drv_Ps2_Cmd_Write(0)



//These are our button constants
#define PSB_SELECT      1
#define PSB_L3          2
#define PSB_R3          3
#define PSB_START       4
#define PSB_PAD_UP      5
#define PSB_PAD_RIGHT   6
#define PSB_PAD_DOWN    7
#define PSB_PAD_LEFT    8
#define PSB_L2          9
#define PSB_R2          10
#define PSB_L1          11
#define PSB_R1          12
#define PSB_GREEN       13
#define PSB_RED         14
#define PSB_BLUE        15
#define PSB_PINK        16
//#define PSB_TRIANGLE    13
//#define PSB_CIRCLE      14
//#define PSB_CROSS       15
#define PSB_ROCKER_RX   17
#define PSB_ROCKER_RY   18
#define PSB_ROCKER_LX   19
#define PSB_ROCKER_LY   20
#define PSB_SQUARE      26



typedef void (*Ps2_State_Cb)(uint8_t Id,uint8_t state);


/**
* @brief  手柄震动函数，
	* @parm   motor1:右侧小震动电机 0x00关，其他开
	   motor2:左侧大震动电机 0x40~0xFF 电机开，值越大 震动越大
	* @retval None
	*/
void Dev_PS2_Vibration(u8 motor1, u8 motor2);
/**
* @brief  PS2手柄摇杆Rx数据
	* @parm   None
	* @retval None
	*/
uint8_t Dev_Ps2_Rocker_Rx_Get(void);

/**
* @brief  PS2手柄摇杆RY数据
	* @parm   None
	* @retval None
	*/
uint8_t Dev_Ps2_Rocker_Ry_Get(void);

/**
* @brief  PS2手柄摇杆LX数据
	* @parm   None
	* @retval None
	*/
uint8_t Dev_Ps2_Rocker_Lx_Get(void);

/**
* @brief  PS2手柄摇杆LY数据
	* @parm   None
	* @retval None
	*/
uint8_t Dev_Ps2_Rocker_Ly_Get(void);

/**
* @brief  PS2手柄是否有新数据
	* @parm   None
	* @retval None
	*/
uint8_t Dev_Ps2_data_update_Get(void);
	
/**
* @brief  PS2手柄数据回调 ID 值
	* @parm   None
	* @retval None
	*/
void Dev_Ps2_Cb_Register(Ps2_State_Cb Cb);

/**
* @brief  PS2手柄组件初始化
	* @parm   None
	* @retval None
	*/
void Dev_Ps2_Init(void);
#endif

